-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally delete points layers after finishing alignment #88
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #88 +/- ##
==========================================
+ Coverage 90.66% 93.52% +2.86%
==========================================
Files 7 7
Lines 257 278 +21
==========================================
+ Hits 233 260 +27
+ Misses 24 18 -6 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @andreasmarnold! I think that it's actually much simpler than expected. 😅
Re testing, I think you can just call the widget again, and that will trigger closing!
src/affinder/affinder.py
Outdated
@@ -136,6 +144,7 @@ def start_affinder( | |||
moving_points: Optional['napari.layers.Points'] = None, | |||
model: AffineTransformChoices, | |||
output: Optional[pathlib.Path] = None, | |||
keep_pts: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reverse this, call it delete_points_when_done
. Label: "Delete points layers when done." Tooltip: "If ticked, the points layers used in alignment will be deleted when clicking 'Finish'."
src/affinder/affinder.py
Outdated
remove_pts_layers.viewer.bind(viewer) | ||
remove_pts_layers.layers.bind(points_layers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realised that it was silly to use magicgui for this at all — functools.partial will do the job:
import functools
...
def remove_layers(viewer, layers):
for layer in layers:
viewer.layers.remove(layer)
...
remove_points_layers = functools.partial(
remove_layers, viewer, [points_layers]
)
...
else:
remove_points_layers()
I'm pretty sure you can do the same thing with close_affinder
🤦, if you want to close #29 with a different PR... 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gdi, wrong button again 😅
993668a
to
2b969f9
Compare
Thanks for the update @andreasmarnold! Let me know if you want me to wrap up this PR myself. |
Hi @jni, Thx! |
2b969f9
to
39109e5
Compare
Whoop whoop! Actually the functools.partial method was a bit trickier than I expected so I'm glad I didn't leave you to finish it on your own. 😂 Remember to |
Haha, yeah I also felt it's not quite as easy when I had a look...
Thanks for your help!
Am Di., 12. Dez. 2023 um 01:33 Uhr schrieb Juan Nunez-Iglesias <
***@***.***>:
… Whoop whoop! Actually the functools.partial method was a bit trickier than
I expected so I'm glad I didn't leave you to finish it on your own. 😂
Remember to git switch main and git pull upstream main to get up to date
with this change! 😊
—
Reply to this email directly, view it on GitHub
<#88 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHCPUYP2QQXJKJLGHNRPTXDYI73B7AVCNFSM6AAAAAA76CDLQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJRGM4DGNJTGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Andreas M. Arnold, PhD
Postdoctoral Fellow
Biochemistry and Biophysics Center
NHLBI, NIH
50 South Drive, Building 50 RM 3310
Bethesda, MD 20892, USA
USA mobile: +1 202 989 9004
AUT mobile: +43 676 6131728
***@***.***
www.linkedin.com/in/andreasmarnold
|
Addresses issue #9
I did not write any tests for this since I didn't really know how (close_affinder also doesn't seem to get tested)
Also, this option has the same issue as described in #29